<div class="action-bar">
  <div class="member-ctls clearfix" member_id="<{$member_id}>">
        <!-- 标准按钮 -->
        <{if $action_buttons}>
            <{foreach from=$action_buttons key=key item=item}>
                <div class="span-auto"><b><{t}>操作：<{/t}></b></div>
                <{foreach from=$item key=subkey item=subitem}>
                    <div class="<{if $smarty.foreach.payments.last}>span-auto<{else}>flt<{/if}> member-action">
                        <{if $subitem.flow}><input type="hidden" name="flow"><{/if}>
                        <{if $subitem.disable}><input type="hidden" name="disabled"><{/if}>
                        <{button type="button"
                           label=$subitem.label
                           app=$subitem.app
                           confirm=$subitem.confirm
                           act=$subitem.act
                        }>&nbsp;
                    </div>
                <{/foreach}>
            <{/foreach}>
        <{/if}>
        <!-- 结束 -->
  </div>
<script>
$$('.member-ctls button[act]').each(function(btn){
       var flow = btn.getPrevious('input[name="flow"]'),
        disabled = btn.getPrevious('input[name="disabled"]'),
        cfm_str = btn.get('confirm'),
        _dialog = null,
        _app    = btn.get('app'),
        act_url = "?app="+_app+"&ctl=admin_member&act={action}&member_id=<{$member_id}>";
       if(disabled){
           return btn.set({'opacity':.5,styles:{'cursor':'not-allowed'}});
       }

       btn.addEvent('click',function(){
          var flag = 1;
          if(btn.get('act') == 'allow'){
            new Request({
              method:'post',
              url:"?app="+_app+"&ctl=admin_member&act=checkMember&member_id=<{$member_id}>",
              data:'member_id='+<{$member_id}>,
              async:false,
              onComplete:function(rs){
                rs = JSON.validate(rs) ? JSON.decode(rs) : null;
                if(rs && rs.status == 'succ'){
                  if(rs.result)
                    flag = 0;
                }
                else{
                  MessageBox.error('something went wrong');
                  return false;
                }
              }
            }).post();
          }
          if(flag == 1 || (flag == 0 && confirm("检测到公司名已存在，是否继续？"))){
            new Request({
              method:'post',
              url:"?app="+_app+"&ctl=admin_member&act=go"+btn.get('act')+"&member_id=<{$member_id}>",
              data:'member_id='+<{$member_id}>,
             //  onSuccess:function(rs){
             //    window.location.reload();
             // }
             onComplete:function(rs){
              json = JSON.validate(rs) ? JSON.decode(rs) : null;
              if(json && json.error) return alert(json.error);

               <{if !$env.get.singlepage}>
                  <{if $env.get.finder_id}>
                    finderGroup['<{$env.get.finder_id}>'].request({
                      method:'post',
                      onComplete:function(){
                         _dialog.close();
                         this.loadPacket();//refersh finder packet(tabs);
                      }});
                  <{/if}>
                <{else}>
                  _dialog.close();
                  if (opener.finderGroup&&opener.finderGroup['<{$env.get.finder_id}>'])
                    opener.finderGroup['<{$env.get.finder_id}>'].refresh();
                   location.reload();
                <{/if}>
              }
              
            }).post();
          }
       });

  });
</script>
</div>
<div class="tableform">
  <div class="division"> <{if $is_bklinks == 'true'}>
    <{input type='refer' id=$member_id ident='member' name=$___b2c='会员'|t:'b2c' show='refer_id,refer_url,refer_time,c_refer_id,c_refer_url,c_refer_time'}>
    <{/if}>
    <{assign var="member_addr" value="公司地址" }>
    <table width="100%" cellspacing="0" cellpadding="0">
      <tr>
        <th><label><{t}>用户姓名：<{/t}></label></th>
        <td><{$mem.contact.name|escape:'html'}></td>
        <th><label><{t}>手机：<{/t}></label></th>
        <td><{$mem.contact.phone.mobile}></td>
        <th><label>E-mail：</label></th>
        <td><{$mem.contact.email}></td>
        <th><label><{t}>注册日期：<{/t}></label></th>
        <td><{$mem.regtime|cdate:FDATE}></td>
      </tr>
      <tr>
        <th><label><{t}>预存款：<{/t}></label></th>
        <td><{$mem.advance.total|cur}></td>
        <th><label><{t}>当前积分：<{/t}></label></th>
        <td class="price0"><{$mem.score.total}></td>
        <th><label><{t}>会员等级：<{/t}></label></th>
        <td><{$mem.member_lv.member_group_name}></td>
        <th><label><{t}>注册IP：<{/t}></label></th>
        <td><{$mem.reg_ip}></td>
      </tr><tr>
        <th><label><{t}>公司名称：<{/t}></label></th>
        <td><{$mem.name|escape:'html'}></td>
        <th><label><{t}>公司类型：<{/t}></label></th>
        <td><{$mem.com_type|escape:'html'}></td>
      </tr>
      <{foreach from=$attr item=item name="item" key='row'}>
      <{if $item.attr_column == 'contact[addr]'}>
      <{assign var="member_addr" value=$item.attr_name }>
      <{continue}>
      <{/if}>
      <{if $row%4 == 0}>
      <tr> <{/if}>
        <th><label><{$item.attr_name}>：</label></th>
        <td><{if $item.attr_group eq 'contact'}>
          <{if $item.attr_tyname eq 'QQ' && $item.attr_value !=''}> <a target="_self" href="tencent://message/?uin=<{$item.attr_value}>&&Site=www.shopex.cn&&Menu=yes"><img border="0" SRC='http://wpa.qq.com/pa?p=1:<{$item.attr_value}>:1' title='<{$item.attr_value}>'></a> <{/if}>
          <{if $item.attr_tyname eq 'MSN' && $item.attr_value !=''}> <a  target="_self" href="msnim:chat?contact=<{$item.attr_value}>"><img width="16" height="16" border="0" src="http://www.wlmessenger.net/static/img/presence/Online.gif" title='<{$item.attr_value}>'/></a> <{/if}>
          <{if $item.attr_tyname eq $__b2c='旺旺'|t:'b2c' }> <a target="_blank" href="http://amos1.taobao.com/msg.ww?v=2&uid=<{$item.attr_value}>&s=1" ><img border="0" src="http://amos1.taobao.com/online.ww?v=2&uid=<{$item.attr_value}>&s=1"  title='<{$item.attr_value}>'/></a> <{/if}>
          <{if $item.attr_tyname eq 'Skype' && $item.attr_value !=''}> <a href="skype:mengsajewel?call"  target="_self"onclick="return skypeCheck();"><img src="http://mystatus.skype.com/smallclassic/<{$item.attr_value}>" style="border: none;" alt="Call me!" title='<{$item.attr_value}>'/></a> <{/if}>
          <{if $item.attr_type =='date'}>
          <{$item.attr_value}>
          <{/if}>
          <{else}>
          <{if $item.attr_type == 'region'}>
          <{$item.attr_value|region}>
          <{elseif $item.attr_type == 'gender'}>
          <{if $mem.profile.gender == 'male'}><{t}>男<{/t}><{elseif $mem.profile.gender == 'female'}><{t}>女<{/t}><{/if}>
          <{else}>
          <{$item.attr_value}>
          <{/if}>
          <{/if}> </td>
        <{if ($row+1)%4 == 0}> </tr>
      <{/if}>
      <{/foreach}>
    </table>
    <table class="multi-cols" width="100%" cellspacing="0" cellpadding="0">
      <tr>
        <th><label><{t}><{$member_addr}>：<{/t}></label></th>
        <td><{$mem.co_address}></td>
      <tr>
      <tr>
        <th><label><{t}>备注：<{/t}></label></th>
        <td><{$mem.remark}></td>
      </tr>
    </table>
  </div>
</div>
<div>
<{include file='admin/member/page_advance_list.html'}>
</div>
